package com.honghu.villagepost.entity;

import android.os.Parcel;
import android.os.Parcelable;

public class Addr extends BaseEntity<Addr> implements Parcelable {
    public int id;
    public String adcode;
    public String address;
    public String city;
    public String district;
    public double latitude;
    public double longitude;
    public String name;
    public String province;
    public String street;
    public String mobile;
    public boolean defaultAddr;

    public Addr() {
    }

    protected Addr(Parcel in) {
        id = in.readInt();
        adcode = in.readString();
        address = in.readString();
        city = in.readString();
        district = in.readString();
        latitude = in.readDouble();
        longitude = in.readDouble();
        name = in.readString();
        province = in.readString();
        street = in.readString();
        mobile = in.readString();
        defaultAddr = in.readByte() != 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(adcode);
        dest.writeString(address);
        dest.writeString(city);
        dest.writeString(district);
        dest.writeDouble(latitude);
        dest.writeDouble(longitude);
        dest.writeString(name);
        dest.writeString(province);
        dest.writeString(street);
        dest.writeString(mobile);
        dest.writeByte((byte) (defaultAddr ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<Addr> CREATOR = new Creator<Addr>() {
        @Override
        public Addr createFromParcel(Parcel in) {
            return new Addr(in);
        }

        @Override
        public Addr[] newArray(int size) {
            return new Addr[size];
        }
    };
}
